
names = ['zhangsan', 'lisi', 'wangwu']
for name in names:
    print(name)


"""
range
创建范围的内置函数
"""
print(list(range(0, 10))) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

for number in range(1, 100):
    print(number)

""" 迭代字典
"""
d = {'name':'sn', 'age':11}

for key in d:
    print(key, d.get(key))

for key,value in d.items():
    print(key, value)

# 迭代时获取索引
str = "hello"
for s in str:
    print(str.index(s), s)
